﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class CashBookFirstPeriod
    {
            public long ID{get;set;}
        [Description("Năm")]
            public int Year { get; set; }
        [Description("Tháng")]
            public int Month{get;set;}
         [Description("Số dư đầu kỳ VNĐ")]           
            public int Money{get;set;}
         [Description("Số dư đầu kỳ USD")]
         public int MoneyUSD { get; set; }
        [Description("Ghi chú")]
            public string Note{get;set;}
         
        public CashBookFirstPeriod()
        {       
                            Note ="";   
        }
        
       static CashBookFirstPeriod DynamicCast<T>(object row_data, object row_header) where T : CashBookFirstPeriod
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           CashBookFirstPeriod ret = new CashBookFirstPeriod();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Month":
                        ret.Month = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Year":
                        ret.Year = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Money":
                        ret.Money = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Note":
                        ret.Note = ConvertObject.ToString(dt[column]);
                       break;
                   case "MoneyUSD":
                       ret.MoneyUSD = ConvertObject.ToInt(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
